noData = () => '暂无数据';

requestTimeOut = () => '请求超时，请检查';

getStartText = () => '正在加载...';

loginFail = () => '请求失败!';

setLoadingState = (index, stateMsg = '', stateUlr = '', container = 'loading_layout', spinner = 'loading_spinner',state = 'loading_state_img', text = 'loading_state_text',targetEle = 'list') => {
	if (index == 0) { //加载中
		$(`#${state}`).hide();
		$(`#${container}`).show();
		$(`#${spinner}`).show();
		$(`#${text}`).show();
		$(`#${text}`).text(stateMsg || getStartText());
		$(`#${targetEle}`).html('');
	}
	if (index == 1) { //隐藏
		$(`#${container}`).hide();
	}
	if (index == 2) { //设置状态
		$(`#${spinner}`).hide();
		$(`#${state}`).show();
		$(`#${container}`).show();
		$(`#${text}`).show();
		$(`#${text}`).text(stateMsg || loginFail());
	}
}

showToast = (msg) => {
	layer.open({
		type: 1,
		content: msg,
		skin: 'msg',
		time: 2 //2秒后自动关闭
	});
}

showActionDialog = (title, msg, callback) => {
	layer.open({
		title: [
			title ? title : '温馨提示',
			'background-color:white; color:#FF34B3;'
		],
		anim: 'up',
		shadeClose: false,
		content: msg,
		btn: ['确定', '取消'],
		yes: function(index) {
			layer.close(index);
			callback(index);
		}
	});
}

showTipsDialog = (msg) => {
	layer.open({
		title: [
			'温馨提示',
			'background-color:white; color:#FF34B3;'
		],
		anim: 'up',
		shadeClose: false,
		content: msg,
		btn: '我知道了'
	});
}
